package com.dfrz.ch07;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 作者：wangmaokang
 * 日期: 2021/4/15 16:11
 * 描述:
 */
public class PhoneTest {
    public static void main(String[] args) {
        String phone="12345678905";
        Pattern pattern=Pattern.compile("1[2-8]\\d{9}");
        Matcher matcher=pattern.matcher(phone);

        if (!matcher.matches()){
            System.out.println("您输入的手机不正确");
        }else {
            System.out.println("正确的手机号码");
        }

    }
}
